package dreamCookGame;

import java.awt.image.BufferedImage;

public class Location extends Scene {

	String _name;
	int _xLeftLimit;
	int _xRightLimit;
	
	public Location(String name, String backgroundImgName, String foregroundImgName, int foregroundX, int foregroundY, Character[] characters, Item[] itemsBack, Item[] itemsFront, int xLeftLimit, int xRightLimit) {
		super(name, backgroundImgName, foregroundImgName, foregroundX, foregroundY, characters, itemsBack, itemsFront);
		_name = name;
		_xLeftLimit = xLeftLimit;
		_xRightLimit = xRightLimit;
		this._characters = characters;
		this._itemsBack = itemsBack;
		this._itemsFront = itemsFront;
	}
		
	public int getXLeftLimit(){
		return _xLeftLimit;
	}
	
	public int getXRightLimit(){
		return _xRightLimit;
	}
	
	public void updateAllCharacters()
	{
		if(this._characters != null)
		{
			for(int i = 0; i < this._characters.length; i++)
			{
				if(this._characters[i]._behaviors != null && this._characters[i]._currentBehavior != null) {
					if(this._characters[i]._isMainCharacter && this._characters[i]._currentBehavior._behaviorName.equals("walk") && this._characters[i]._isWalking)
						this._characters[i].updateWalk();
					else if(!this._characters[i]._currentBehavior._behaviorName.equals("walk") && !this._characters[i]._isWalking)
						this._characters[i].update();
				}
			}
		}
	}
}
